import Service from './$axios'
import { lotAuth, lotAuth2 } from '../../config'
//登录
export const login = (name, password) => {
	return Service({
		url: '/zuul/login?account=' + name + '&password=' + password,
		method: 'post'
	})
}
//登出
export const loginOut = () => {
	return Service({
		url: '/zuul/logout',
		method: 'post'
	})
}
//根据id获取用户
export const queryUserById = (id) => {
	return Service({
		url: lotAuth + '/user/queryUserById?userId=' + id,
		method: 'get'
	})
}
//获取菜单
export const getMenus = (str) => {
	return Service({
		url: lotAuth + '/menu/queryTreeMenu?type=' + str,
		method: 'get',
	})
}
//添加 修改 菜单
export const addMenu = (data) => {
	return Service({
		url: lotAuth + '/menu/addMenu',
		method: 'post',
		data: data,
	})
}

//删除菜单
export const deleteMenu = (id) => {
	return Service({
		url: lotAuth + '/menu/deleteMenu/' + id,
		method: 'delete'
	})
}

//根据id获取菜单
export const getMenuById = (id) => {
	return Service({
		url: lotAuth + '/menu/queryMenuParentById/' + id,
		method: 'get'
	})
}

//新增 修改 按钮
export const addOrUpdateBtn = (data) => {
	return Service({
		url: lotAuth + '/button/addButton',
		method: 'post',
		data: data
	})
}

//根据菜单id查询按钮
export const getBtnByMenuId = (id) => {
	return Service({
		url: lotAuth + '/button/queryButton/' + id,
		method: 'get'
	})
}
//删除按钮
export const deleteBtnById = (id) => {
	return Service({
		url: lotAuth + '/button/deleteButton/' + id,
		method: 'delete'
	})
}

// //获取部门
// export const getDepartMents = () => {
// 	return Service({
// 		url: lotAuth + '/department/queryTreeDepartment',
// 		method: 'get',
// 	})
// }
//获取部门
export const getDepartMents = () => {
	return Service({
		url: lotAuth2 + '/department/queryTreeDepartment',
		method: 'get',
	})
}

//添加 修改 部门
export const addDepartMent = (data) => {
	return Service({
		url: lotAuth + '/department/addDepartment',
		method: 'post',
		data: data,
	})
}

//删除部门
export const deleteDepartMent = (id) => {
	return Service({
		url: lotAuth + '/department/deleteDepartment/' + id,
		method: 'delete'
	})
}

//获取角色
export const getRoles = () => {
	return Service({
		// url: lotAuth + '/role/queryPageRole?pageNum=1&pageSize=9999',
		url: lotAuth2 + '/role/queryPageRole?pageNum=1&pageSize=9999',
		method: 'get',
	})
}

//添加 修改 部门
export const addOrUpdateRole = (data) => {
	return Service({
		url: lotAuth + '/role/addRole',
		method: 'post',
		data: data,
	})
}

//删除角色
export const deleteRole = (id) => {
	return Service({
		url: lotAuth + '/role/deleteRole/' + id,
		method: 'delete'
	})
}


//根据角色id查询拥有权限
export const queryRoleMenuList = (id, type) => {
	return Service({
		url: lotAuth + '/role/queryRoleMenuList?roleId=' + id + '&type=' + type,
		method: 'get'
	})
}
//权限配置
export const authorityDeploy = (data) => {
	return Service({
		url: lotAuth + '/role/authorityDeploy',
		method: 'post',
		data: data,
	})
}

//查询所有用户
export const getUsers = (str) => {
	return Service({
		url: lotAuth2 + '/user/queryPageUser?pageNum=1&pageSize=9999' + str,
		method: 'get',
	})
}

//添加 修改 用户
export const addOrUpdateUser = (data) => {
	return Service({
		url: lotAuth + '/user/addUser',
		method: 'post',
		data: data,
	})
}

//角色分配
export const roleAssignment = (data) => {
	return Service({
		url: lotAuth + '/user/roleAssignment',
		method: 'post',
		data: data,
	})
}

//删除用户
export const deleteUser = (id) => {
	return Service({
		url: lotAuth + '/user/deleteUser/' + id,
		method: 'delete'
	})
}
//重置用户密码
export const resetPassword = (id) => {
	return Service({
		url: lotAuth + '/user/ressetPss/' + id,
		method: 'get'
	})
}

//得到日志类型
export const getLogTypes = () => {
	return Service({
		url: '/gd-wms-log/log/queryLogType',
		method: 'get'
	})
}

//查询所有日志
export const getLogs = (str) => {
	return Service({
		url: '/gd-wms-log/log/queryPageLog?pageNum=1&pageSize=9999' + str,
		method: 'get',
	})
}

// ************************************************************************
// 查询文件
export const getFiles = (str) => {
	return Service({
		url: '/file/file/queryFilePage?' + str,
		method: 'get',
	})
}

//删除文件
export const deleteFiles = (id) => {
	return Service({
		url: '/file/file/deleteFile/' + id,
		method: 'delete'
	})
}
//下载文件
export const downloadFiles = (id) => {
	return Service({
		url: '/file/file/downloadFile/' + id,
		method: 'get'
	})
}
//显示文件
export const showFiles = (id) => {
	return Service({
		url: '/file/file/queryFileId/' + id,
		method: 'get'
	})
}
//添加 修改 文件
export const addFiles = (data) => {
	return Service({
		url: '/file/file/uploadFile',
		method: 'post',
		data: data,
	})
}
// 查询文件类型
export const getFileTypeList = (data) => {
	return Service({
		url: '/file/fileType/queryFileTypeList',
		method: 'get'
	})
}
// 查询文件标签
export const getFileTagList = (data) => {
	return Service({
		url: '/file/fileTag/queryTagList',
		method: 'get'
	})
}

//添加 修改文件类型
export const addFileType = (data) => {
	return Service({
		url: '/file/fileType/addFileType',
		method: 'post',
		data: data,
	})
}

//删除文件类型
export const deleteFileType = (id) => {
	return Service({
		url: '/file/fileType/deleteFileType/' + id,
		method: 'delete',
	})
}

//分页查询文件类型
export const queryFileType = (str) => {
	return Service({
		url: '/file/fileType/queryFileType?' + str,
		method: 'get',

	})
}

//查询文件类型
export const queryFileTypeList = () => {
	return Service({
		url: '/file/fileType/queryFileTypeList',
		method: 'get',
	})
}

//分页查询文件标签
export const queryTag = (str) => {
	return Service({
		url: '/file/fileTag/queryTag?' + str,
		method: 'get',

	})
}

//删除文件标签
export const deleteTag = (id) => {
	return Service({
		url: '/file/fileTag/deleteTag/' + id,
		method: 'delete',
	})
}

//添加 修改文件标签
export const addTag = (data) => {
	return Service({
		url: '/file/fileTag/addTag',
		method: 'post',
		data: data,
	})
}

//***************************************************************************
//分页查询
export const findBasePageList = (str) => {
	return Service({
		url: 'gd-wms-base/base/findBasePageList?' + str,
		method: 'get',

	})
}
//根据企业编号查询详情
export const findBaseById = (enterpriseNumber) => {
	return Service({
		url: 'gd-wms-base/base/findBaseById/' + enterpriseNumber,
		method: 'get',

	})
}

//修改供应商基础信息
export const updateSupplier = (data) => {
	return Service({
		url: 'gd-wms-base/base/updateSupplier',
		method: 'put',
		data: data
	})
}

//修改供应商基础信息
export const updateInviteStatus = (data) => {
	return Service({
		url: 'gd-wms-base/base/updateInviteStatus',
		method: 'put',
		data: data
	})
}

// 新增数据字典
export const add = (data) => {
	return Service({
		url: 'gd-wms-base/Dictionary/add',
		method: 'post',
		data: data
	})
}

//查询数据字典
export const find = () => {
	return Service({
		url: 'gd-wms-base/Dictionary/find',
		method: 'get',
	})
}

//删除数据字典
export const deleteDictionary = (id) => {
	return Service({
		url: 'gd-wms-base/Dictionary/deleteDictionary/' + id,
		method: 'delete',
	})
}
//修改数据字典
export const update = (data) => {
	return Service({
		url: 'gd-wms-base/Dictionary/update',
		method: 'put',
		data: data
	})
}

//***********************************************************************
//库房管理 查询储位树
export const findDepot = () => {
	return Service({
		url: 'gd-wms-base/depotManagement/findDepot',
		method: 'get',
	})
}

//添加储位
export const addDepot = (data) => {
	return Service({
		url: 'gd-wms-base/depotManagement/addDepot',
		method: 'post',
		data: data
	})
}

//删除储位
export const deleteDepot = (id) => {
	return Service({
		url: 'gd-wms-base/depotManagement/deleteDepot?id=' + id,
		method: 'delete',
	})
}

//修改储位
export const updateDepotManagement = (data) => {
	return Service({
		url: 'gd-wms-base/depotManagement/updateDepotManagement',
		method: 'put',
		data: data
	})
}

//修改流离货架详情
export const updateBaseFluentRack = (data) => {
	return Service({
		url: 'gd-wms-base/depotManagement/updateBaseFluentRack',
		method: 'put',
		data: data
	})
}

//查询流离货架详情
export const findBaseFluentRack = (storageLocationCod) => {
	return Service({
		url: 'gd-wms-base/depotManagement/findBaseFluentRack?storageLocationCod=' + storageLocationCod,
		method: 'get',
	})
}

//查询高位货架详情
export const findBaseHighLevel = (storageLocationCod) => {
	return Service({
		url: 'gd-wms-base/depotManagement/findBaseHighLevel?storageLocationCod=' + storageLocationCod,
		method: 'get',
	})
}

//修改高位货架详情
export const updateBaseHighLevel = (data) => {
	return Service({
		url: 'gd-wms-base/depotManagement/updateBaseHighLevel',
		method: 'put',
		data: data
	})
}
//**********************************

//新增周期计划
export const addJob = (data) => {
	return Service({
		url: 'gd-wms-timer/job/addJob',
		method: 'post',
		data: data
	})
}

//根据id删除周期计划
export const deleteJob = (id) => {
	return Service({
		url: 'gd-wms-timer/job/deleteJob?id=' + id,
		method: 'delete',
	})
}

//周计划分组查询
export const findJobClassList = () => {
	return Service({
		url: 'gd-wms-timer/job/findJobClassList',
		method: 'get',
	})
}

//分页查询周期计划
export const findJobList = (str) => {
	return Service({
		url: 'gd-wms-timer/job/findJobList' + str,
		method: 'get'
	})
}

//修改周期计划
export const updateJob = (data) => {
	return Service({
		url: 'gd-wms-timer/job/updateJob',
		method: 'put',
		data: data
	})
}

//打印所有流离货架
export const findBaseFluentRacks = () => {
	return Service({
		url: 'gd-wms-base/depotManagement/findBaseFluentRacks',
		method: 'get'
	})
}

//打印所有高位货架
export const findBaseHighLevelRacks = () => {
	return Service({
		url: 'gd-wms-base/depotManagement/findBaseHighLevelRacks',
		method: 'get'
	})
}
/********** */
//工单物料查询
export const queryFindPositionByBill = (str) => {
	return Service({
		url: 'gd-wms-outbound/outBound/findWorkOrderMatter' + str,
		method: 'get'
	})
}
//补料单物料查询
export const queryFindFillBillMatter = (str) => {
	return Service({
		url: 'gd-wms-outbound/outBound/findFillBillMatter' + str,
		method: 'get'
	})
}
//工单查询
export const queryOutWorkList = (str) => {
	return Service({
		url: 'gd-wms-outbound/outBound/findWorkOrder' + str,
		method: 'get'
	})
}

//补料单查询
export const queryOutSupplementList = (str) => {
	return Service({
		url: 'gd-wms-outbound/outBound/findFillBill' + str,
		method: 'get'
	})
}
//工单分配
export const queryWorkPicking = (data) => {
	return Service({
		url: 'gd-wms-outbound/outBound/dispatchWorkOrder',
		method: 'post',
		data: data
	})
}
//补料单分配
export const queryFillBillPicking = (data) => {
	return Service({
		url: 'gd-wms-outbound/outBound/dispatchFillBill',
		method: 'post',
		data: data
	})
}
//流利架库存警告列表
export const queryLLJWarning = (data) => {
	return Service({
		url: 'gd-wms-cougny/alarm/findDeficitAlarmList' + data,
		method: 'get'
	})
}
//调拨单查询
export const queryDbdList = (data) => {
	return Service({
		url: 'alarm/findTransferOrderList' + data,
		method: 'get'
	})
}
/*/cougnyIncventoryOperation/findCougnyPageList
分页查询Cougny*/

/**
 * /incventory/findAllPageList
 分页查询盘点操作
 * @param data
 * @returns {AxiosPromise}
 */
export const queryPandianProjectList = (data) => {
	return Service({
		url: 'gd-wms-cougny/stockTaking/queryStockTaking',
		method: 'post',
		data: data
	})
}
/**
 * /IncventoryProject/findIncventoryProjectDetailsList
 点击盘点项目详情
 */
export const findIncventoryProjectDetailsList = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryProject/findIncventoryProjectDetailsList?id=' + data,
		method: 'get'
	})
}
/***
 * /IncventoryProject/deleteIncventoryProject/{id}
 根据id删除盘点项目
 */
/**
 * /cougnyIncventoryOperation/deleteCougny/{id}
 根据id删除盘点
 * @param data
 * @returns {AxiosPromise}
 */
export const deleteIncventoryProject = (data) => {
	return Service({
		url: 'gd-wms-cougny/stockTaking/deleteStockTaking?' + data,
		method: 'get'
	})
}
/**
 *  // /IncventoryProject/addIncventoryProject
 // 新增/修改盘点项目
 // 新增和修改
 * @param data
 * @returns {AxiosPromise}
 */
/**
 *
 * @param data
 * @returns {AxiosPromise}
 */


/*/cougnyIncventoryOperation/addCougny
新增/修改盘点*/
/**
 * /incventory/addIncventory
 新增
 * @param data
 * @returns {AxiosPromise}
 */
export const addIncventoryProject = (data) => {
	return Service({
		url: 'gd-wms-cougny/stockTaking/addStockTaking',
		data: data,
		method: 'post'
	})
}
/**
 *  /**
 * /incventory/queryCheckList
 盘点表数据
 */

export const queryCheckList = (data) => {
	return Service({
		url: 'gd-wms-cougny/incventory/queryCheckList?operationId=' + data,
		method: 'get'
	})
}
/*/alarm/findTransferOrderList
分页查询调拨单*/

export const findTransferOrderList = (data) => {
	return Service({
		url: 'gd-wms-cougny/alarm/findTransferOrderList' + data,
		method: 'get'
	})
}
/*/alarm/deleteTransferOrder/{id}
		根据id删除demo*/
export const deleteTransferOrder = (data) => {
	return Service({
		url: 'gd-wms-cougny/alarm/deleteTransferOrder/' + data,
		method: 'delete'
	})
}
//alert("dd")
/*/InventoryVariance/deleteInventoryVariance/{id}
    根据id删除盘点差异表*/
export const deleteInventoryVariance = (data) => {
	return Service({
		url: 'gd-wms-cougny/InventoryVariance/deleteInventoryVariance/' + data,
		method: 'delete'
	})
}
/**
 *
 /InventoryVariance/inventoryVariancePageList
 分页查询盘点差异表
 */
export const inventoryVariancePageList = (data) => {
	return Service({
		url: 'gd-wms-cougny/InventoryVariance/inventoryVariancePageList' + data,
		method: 'get'
	})
}
//下拉框查询储存位置
export const findLocationCodPageList = () => {
	return Service({
		url: 'gd-wms-cougny/IncventoryProject/findLocationCodPageList',
		method: 'get'
	})
}
//cougnyIncventoryOperation/findWarehouse分页查询仓库
/*/cougnyIncventoryOperation/findWarehouse
			根据物料查询*/
export const findWarehouse = (data) => {
	return Service({
		url: 'gd-wms-cougny/cougnyIncventoryOperation/findWarehouse?storageLocationCod=' + data,
		method: 'get'
	})
}
/*/cougnyIncventoryOperation/findGradePageList
		树形分页查询Cougny*/
/*/cougnyIncventoryOperation/findByGrade
各个级别的查询*/
/**
 * /incventory/queryWarehouseList
 仓库/区域/货架集合
 * @param data
 * @returns {AxiosPromise}
 */
export const findGradePageList = (data) => {
	return Service({
		url: 'gd-wms-cougny/stockTaking/queryWarehouseList' + "?parentIds=" + data,
		method: 'get',
		//data: data
	})
}
///stockTaking/queryWarehouseUser 查询库管员
export const queryWarehouseUser = () => {
	return Service({
		url: 'gd-wms-cougny/stockTaking/queryWarehouseUser',
		method: 'get',
	})
}
/*/incventory/queryMaterialList
          物料集合*/
export const queryMaterialList = (data) => {
	return Service({
		url: 'gd-wms-cougny/incventory/queryMaterialList',
		method: 'post',
		//data: data
	})
}
/**
 *
 /IncventoryPlan/deleteIncventoryPlan/{id}
 根据id删除IncventoryPlan
 * @param data
 * @returns {AxiosPromise}
 */
export const deleteIncventoryPlan = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/deleteIncventoryPlan/' + data,
		method: 'delete'
	})
}
/**
 *
 /IncventoryPlan/findTaskList
 任务界面
 * @param data
 * @returns {AxiosPromise}
 */
export const findTaskList = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/findTaskList' + data,
		method: 'post'
	})
}
/**
 * /cougnyIncventoryOperation/findCougnyPageList
 分页查询Cougny
 */
export const findCougnyPageList = (data) => {
	return Service({
		url: 'gd-wms-cougny/cougnyIncventoryOperation/findCougnyPageList?id=' + data.id,
		method: 'get'
	})
}
/**
 *

 /IncventoryPlan/releaseIncventoryPlan
 发布计划|生成任务
 * @param data
 * @returns {AxiosPromise}
 */
export const releaseIncventoryPlan = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/releaseIncventoryPlan?id=' + data,
		method: 'get'
	})
}
/**

 /IncventoryProject/releaseIncventoryProject
 发布项目
 */
/**
 * /cougnyIncventoryOperation/implementCougny
 执行盘点
 */
/**
 * /incventory/saveRecord
 执行保存数据
 * @param item
 */
export const releaseIncventoryProject = (data) => {
	return Service({
		url: 'gd-wms-cougny/stockTaking/updateState?' + data,
		method: 'get'
	})
}
/*/cougnyIncventoryOperation/exportCougnyIncventoryRecord
	导出*/
export const exportCougnyIncventoryRecord = () => {
	return Service({
		url: 'gd-wms-cougny/cougnyIncventoryOperation/exportCougnyIncventoryRecord',
		method: 'get'
	})
}
/**
 *
 /IncventoryPlan/findIncventoryPlanDetailsList
 点击盘点计划的详情
 * @param data
 * @returns {AxiosPromise}
 */
export const findIncventoryPlanDetailsList = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/findIncventoryPlanDetailsList?incventoryPlanId=' + data,
		method: 'get'
	})
}
///下拉框查询物料编码
export const findMaterielList = () => {
	return Service({
		url: 'gd-wms-cougny/IncventoryProject/findMaterielList',
		method: 'get'
	})
}
///IncventoryPlan/findincventoryPlanServicePageList
//分页查询盘点计划以及详情
export const findincventoryPlanServicePageList = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/findincventoryPlanServicePageList' + data,
		method: 'get'
	})
}
/**
 * /IncventoryProject/findIncventoryProjectPageList
 分页查询盘点项目
 */
export const findIncventoryProjectPageList = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryProject/findIncventoryProjectPageList' + data,
		method: 'get'
	})
}
/**
 * /IncventoryPlan/selectUser
 下拉框查询盘点人员
 */
export const selectUser = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/selectUser' + data,
		method: 'get'
	})
}
/**
 * /IncventoryPlan/addIncventoryPlan
 新增/修改盘点计划接口
 * @param data
 * @returns {AxiosPromise}
 */
export const addIncventoryPlan = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/addIncventoryPlan',
		data: data,
		method: 'post'
	})
}

/******************************************************入库管理 */
//质检单查询
export const queryInspectionSheet = () => {
	return Service({
		url: 'gd-wms-warehousing/warehousing/queryInspectionSheet',
		method: 'get'
	})
}
//质检单详情
export const queryInspectionSheetDetails = (data) => {
	return Service({
		url: 'gd-wms-warehousing/warehousing/queryInspectionSheetDetails',
		method: 'post',
		data: data
	})
}

//质检单图片详情
export const queryInspectionSheetDetailsPhotos = (data) => {
	return Service({
		url: 'gd-wms-warehousing/warehousing/queryInspectionSheetDetailsPhotos',
		method: 'post',
		data: data
	})
}
//质检单条件查询
export const queryInspectionSheetBySearch = (data) => {
	return Service({
		url: 'gd-wms-warehousing/warehousing/queryInspectionSheetBySearch',
		method: 'post',
		data: data
	})
}
//入库web端审核
export const reportSRM = (data) => {
	return Service({
		url: 'gd-wms-warehousing/warehousing/reportSRM',
		method: 'post',
		data: data
	})
}
//成品出库
export const queryShipmentOut = (data) => {
	return Service({
		url: 'gd-wms-outbound/outBound/outProduct',
		method: 'post',
		data: data
	})
}
/*/IncventoryPlan/findTaskByPoneList
		盘点任务详情界面*/
export const findTaskByPoneList = (data) => {
	return Service({
		url: 'gd-wms-cougny/IncventoryPlan/findTaskByPoneList?id=' + data,
		method: 'post',
	})
}
//成品批量查询
export const queryManyShipment = (data) => {
	return Service({
		url: 'gd-wms-outbound/outBound/findProductById',
		method: 'post',
		data: data
	})
}
//成品出库列表
export const queryShipment = (str) => {
	return Service({
		url: 'gd-wms-outbound/outBound/findProduct' + str,
		method: 'get',
	})
}

///NewAlarm/queryCougny条件查询调拨单，并分页
export const queryCougny = (data) => {
	return Service({
		url: 'gd-wms-cougny/NewAlarm/queryCougny',
		method: 'post',
		data
	})
}
///newAlarm/queryWarning流利架库存预警,web端
export const queryWarning = (data) => {
	return Service({
		url: 'gd-wms-cougny/newAlarm/queryWarning',
		method: 'post',
		data
	})
}